The JCilk Language for Multithreaded Computing
نویسندگان
چکیده
JCilk extends the Java language to provide call-return semantics for multithreading, much as Cilk does for C. Java’s built-in thread model does not support the passing of exceptions or return values from one thread back to the “parent” thread that created it. JCilk imports Cilk’s fork-join primitives spawn and sync into Java to provide procedure-call semantics for concurrent subcomputations. This paper shows how JCilk integrates exception handling with multithreading by defining semantics consistent with the existing semantics of Java’s try and catch constructs, but which handle concurrency in spawned methods. JCilk’s strategy of integrating multithreading with Java’s exception semantics yields some surprising semantic synergies. In particular, JCilk extends Java’s exception semantics to allow exceptions to be passed from a spawned method to its parent in a natural way that obviates the need for Cilk’s inlet and abort constructs. This extension is “faithful” in that it obeys Java’s ordinary serial semantics when executed on a single processor. When executed in parallel, however, an exception thrown by a JCilk computation signals its sibling computations to abort, which yields a clean semantics in which only a single exception from the enclosing try block is handled. The decision to implicitly abort side computations opens a Pandora’s box of subsidiary linguistic problems to be resolved, however. For instance, aborting might cause a computation to be interrupted asynchronously, causing havoc in programmer understanding of code behavior. To minimize the complexity of reasoning about aborts, JCilk signals them “semisynchronously” so that abort signals do not interrupt ordinary serial code. In addition, JCilk propagates an abort signal throughout a subcomputation naturally with a built-in CilkAbort exception, thereby allowing programmers to handle clean-up by simply catching the CilkAbort exception. The semantics of JCilk allow programs with speculative computations to be programmed easily. Speculation is essential for parThis research was supported in part by the Singapore-MIT Alliance and by NSF Grant ACI-0324974. I-Ting Angelina Lee was supported in part by a Sun Microsystems Fellowship. Copyright c © 2005 by John S. Danaher, I-Ting Angelina Lee, and Charles E. Leiserson. allelizing programs such as branch-and-bound or heuristic search. We show how JCilk’s linguistic mechanisms can be used to program a solution to the “queens” problem with speculative computations.
منابع مشابه
Programming with exceptions in JCilk
JCilk extends the serial subset of the Java language by importing the fork-join primitives spawn and sync from the Cilk multithreaded language, thereby providing call-return semantics for multithreaded subcomputations. In addition, JCilk transparently integrates Java’s exception handling with multithreading by extending the semantics of Java’s try and catch constructs, but without adding new ke...
متن کاملHosted by OOPSLA 2005 Preface
JCilk extends the Java language to provide call-return semantics for multithreading, much as Cilk does for C. Java’s built-in thread model does not support the passing of exceptions or return values from one thread back to the “parent” thread that created it. JCilk imports Cilk’s fork-join primitives spawn and sync into Java to provide procedure-call semantics for concurrent subcomputations. Th...
متن کاملUML Modeling and Performance Evaluation of Multithreaded Programs on Dual Core Processor
Modern Object oriented programming languages provide the facility of multithreading programming which provides concurrent execution of multiple threads within the same program. Basically, threads provide a way to execute code in parallel within the same program. In high performance computing today, the multi-core CPUs have become more common in nearly all computer systems. These processors have...
متن کاملThe VerCors Tool for Verification of Concurrent Programs
The VerCors tool implements thread-modular static verification of concurrent programs, annotated with functional properties and heap access permissions. The tool supports both generic multithreaded and vector-based programming models. In particular, it can verify multithreaded programs written in Java, specified with JML extended with separation logic. It can also verify parallelizable programs...
متن کاملCompiler Assisted Speculation for Multithreaded Programming
Multithreaded programming, which well fits the structure of modern shared memory systems, is becoming one of the most popular parallel programming models. Two important supporting components of multithreaded programming, concurrent data structures and transactional memory, can benefit from speculation. However, traditional speculation mechanisms, which do not exploit high level knowledge about ...
متن کامل